home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
bitstrg
/
read.me
< prev
next >
Wrap
Text File
|
1989-06-05
|
5KB
|
189 lines
june 05, 1989
Bit manipulation in C
(bitstrg)
The archivees are :
- sbitstrg.lib library of the bit manipulation functions
- sbitstrg.pub references to this library
- bitstrg.h The include file
- bitstrg.c The source file to test the bit
manipulation functions (1 to 65536 bits)
- lbitstrg.c The source file to test the bit
manipulation functions (1 to xxxxxx bits)
- *.c The source files of all the functions
(1 to 65536 bits)
- l*.c The source files of all the functions
(1 to xxxxxx bits)
- cpbit.mk The make file to generate the executable
test for 1 to 65536 bits
- cplbit.mk The make file to generate the executable
test for 1 to xxxxxx bits
Compiler used : Microsoft C 5.1. Should be easily portable.
The functions in the library are :
/*
Creation of an array of bit
The array is initialized to all 0s
return a pointer on the array parameters structure or NULL if problem
*/
struct SPARRAY* crebitarray(nbbit)
unsigned nbbit; /* number of the last bit in the array */
/*
Clear bit array to all 0s
*/
void clrbitarray(ptr)
struct SPARRAY * ptr; /* pointer on structure */
/*
declaration of a memory field as an array of bit
return a pointer on the array parameters structure or NULL if problem
*/
struct SPARRAY* decarbit(ptr,nombr)
ELEBAR* ptr; /* pointer on the memory field */
unsigned nombr; /* number of elements in the field */
/*
invert state of specified bit
if bit > map size, 0 is returned, else 1 is returned
*/
unsigned invertbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */
/*
Set specified bit
if bit > map size, 0 is returned, else 1 is returned
*/
unsigned setbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */
/*
Clear specified bit
*/
unsigned clearbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */
/*
Test specified bit
return non zero if set, else return zero
*/
unsigned testbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */
/*
Restitution of the memory space of an array of bit
*/
void freebitarray(ptr)
struct SPARRAY * ptr; /* pointer on structure */
/*
Creation of an array of bit
The array is initialized to all 0s
return a pointer on the array parameters structure or NULL if problem
*/
struct LSPARRAY* lcrebitarray(nbbit)
unsigned long nbbit; /* number of the last bit in the array */
/*
Clear bit array to all 0s
*/
void lclrbitarray(ptr)
struct LSPARRAY * ptr; /* pointer on structure */
/*
declaration of a memory field as an array of bit
return a pointer on the array parameters structure or NULL if problem
*/
struct LSPARRAY* ldecarbit(ptr,nombr)
ELEBAR* ptr; /* pointer on the memory field */
unsigned nombr; /* number of elements in the field */
/*
invert state of specified bit
if bit > map size, 0 is returned, else 1 is returned
*/
unsigned linvertbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */
/*
Set specified bit
if bit > map size, 0 is returned, else 1 is returned
*/
unsigned lsetbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */
/*
Clear specified bit
*/
unsigned lclearbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */
/*
Test specified bit
return non zero if set, else return zero
*/
unsigned ltestbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */
/*
Restitution of the memory space of an array of bit
*/
void lfreebitarray(ptr)
struct LSPARRAY * ptr; /* pointer on structure */